package concurrent.c_000_Thread;

import util.ThreadUtil;

/**
 * https://www.cnblogs.com/jhxxb/p/10821483.html
 */
public class T04_ThreadState {
    public static void main(String[] args) {
        Thread t = new MyThread();
        System.out.println(t.getState());
        t.start();
        ThreadUtil.join(t);
        System.out.println(t.getState());
    }

    static class MyThread extends Thread {
        @Override
        public void run() {
            System.out.println(this.getState());
            for (int i = 0; i < 10; i++) {
                ThreadUtil.sleepMillis(500);
                System.out.println(i);
            }
        }
    }
}
